import Layout from "../components/Layout/Layout";

/**
 * 需要授权访问的路由
 */
const asyncRoutesChildren = [
  {
    path: "/",
    name: "Home",
    meta: {
      roles: ["admin", "test"],
      title: "数据统计",
      icon: "bar_chart",
      keepAlive: true
    },
    component: () => import("../pages/home/home.vue")
  },
  {
    path: "/user",
    name: "User",
    meta: {
      roles: ["admin"],
      title: "用户管理",
      icon: "admin_panel_settings",
      isOpen: true
    },
    component: Layout,
    children: [
      {
        path: "account",
        name: "UserAccount",
        meta: {
          roles: ["admin"],
          title: "账号管理",
          icon: "person",
          keepAlive: true
        },
        component: () => import("../pages/user/account")
      }
      // {
      //   path: "role",
      //   name: "UserRole",
      //   meta: {
      //     roles: ["admin"],
      //     title: "角色管理",
      //     icon: "verified_user",
      //     keepAlive: true
      //   },
      //   component: () => import("../pages/user/role")
      // },
      // {
      //   path: "route",
      //   name: "UserRoute",
      //   meta: {
      //     roles: ["admin"],
      //     title: "权限管理",
      //     icon: "link",
      //     keepAlive: true
      //   }
      //   // component: () => import("../pages/user/route")
      // }
    ]
  },
  {
    path: "/group",
    name: "Group",
    meta: {
      roles: ["admin"],
      title: "团队管理",
      icon: "group"
    },
    component: () => import("../pages/group/group")
  },
  {
    path: "/task",
    name: "Task",
    meta: {
      roles: ["admin"],
      title: "任务管理",
      icon: "markunread_mailbox"
    },
    component: () => import("../pages/task/task")
  },
  {
    path: "*", // 此处需置于最底部
    redirect: "/NoFound404",
    meta: {
      roles: ["admin"],
      isHidden: true
    }
  }
];

const asyncRoutes = [
  {
    path: "/",
    name: "index",
    redirect: "/",
    component: () => import("../layouts/MainLayout"),
    children: asyncRoutesChildren
  }
];

export default asyncRoutes;

export { asyncRoutesChildren };
